import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

import java.io.*;
;


public class PersonnageDet extends JPanel implements ActionListener {
	private JTextField evActu;
	private JTextField evMax;
	private JTextField tfCou;
	private JTextField tfInt;
	private JTextField tfCha;
	private JTextField tfAdr;
	private JTextField tfFo;
	private JTextField eaActu;
	private JTextField eaMax;
	private JTextField tfAt;
	private JTextField tfPrd;
	private JTextField tfPr;
	private JTextField tfPDestin;
	private JTextField tfPo;
	
	private JButton btnDownEV;
	private JButton btnDownCou;
	private JButton btnDownInt;
	private JButton btnDownCha;
	private JButton btnDownAdr;
	private JButton btnDownFo;
	private JButton btnDownEA;
	private JButton btnDownAt;
	private JButton btnDownPrd;
	private JButton btnDownPr;
	private JButton btnDownPDestin;
	private JButton btnDownPo;
	
	private JButton btnUpEV;
	private JButton btnUpCou;
	private JButton btnUpInt;
	private JButton btnUpCha;
	private JButton btnUpAdr;
	private JButton btnUpFo;
	private JButton btnUpEA;
	private JButton btnUpAt;
	private JButton btnUpPrd;
	private JButton btnUpPr;
	private JButton btnUpPDestin;
	private JButton btnUpPo;
	private Personnage perso;
	/**
	 * Create the panel.
	 */
	public PersonnageDet(Personnage p) {
		
		perso = p;
		
		System.out.println("2 : " + perso.toString());
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[]{1, 0};
		gridBagLayout.rowHeights = new int[]{250, 50, 0, 0};
		gridBagLayout.columnWeights = new double[]{1.0, Double.MIN_VALUE};
		gridBagLayout.rowWeights = new double[]{0.0, 0.0, 1.0, Double.MIN_VALUE};
		setLayout(gridBagLayout);
		
		JPanel panel = new JPanel();
		GridBagConstraints gbc_panel = new GridBagConstraints();
		gbc_panel.insets = new Insets(0, 0, 5, 0);
		gbc_panel.fill = GridBagConstraints.BOTH;
		gbc_panel.gridx = 0;
		gbc_panel.gridy = 0;
		add(panel, gbc_panel);
		GridBagLayout gbl_panel = new GridBagLayout();
		gbl_panel.columnWidths = new int[]{25, 208, 224, 0};
		gbl_panel.rowHeights = new int[]{250, 0};
		gbl_panel.columnWeights = new double[]{0.0, 0.0, 1.0, Double.MIN_VALUE};
		gbl_panel.rowWeights = new double[]{1.0, Double.MIN_VALUE};
		panel.setLayout(gbl_panel);
		this.setPreferredSize(new Dimension(450, 300));
		this.setMaximumSize(new Dimension(450, 300));
		
		JPanel panel_4 = new JPanel();
		GridBagConstraints gbc_panel_4 = new GridBagConstraints();
		gbc_panel_4.insets = new Insets(0, 0, 0, 5);
		gbc_panel_4.fill = GridBagConstraints.BOTH;
		gbc_panel_4.gridx = 0;
		gbc_panel_4.gridy = 0;
		panel.add(panel_4, gbc_panel_4);
		panel_4.setLayout(new BorderLayout(0, 0));
		
		JLabel lblLvl = new JLabel("Lvl : " + perso.getNiveau());
		panel_4.add(lblLvl, BorderLayout.NORTH);
		
		JPanel panel_3 = new JPanel();
		GridBagConstraints gbc_panel_3 = new GridBagConstraints();
		gbc_panel_3.insets = new Insets(0, 0, 0, 5);
		gbc_panel_3.fill = GridBagConstraints.BOTH;
		gbc_panel_3.gridx = 1;
		gbc_panel_3.gridy = 0;
		panel.add(panel_3, gbc_panel_3);
		panel_3.setLayout(new GridLayout(0, 1, 0, 0));
		
		JLabel lblNom = new JLabel("Nom : " + perso.getNom());
		panel_3.add(lblNom);
		
		JLabel lblRace = new JLabel("Race : " + perso.getOrigine());
		panel_3.add(lblRace);
		
		JPanel pan_EV = new JPanel();
		panel_3.add(pan_EV);
		GridBagLayout gbl_pan_EV = new GridBagLayout();
		gbl_pan_EV.columnWidths = new int[]{32, 60, 60, 32, 0};
		gbl_pan_EV.rowHeights = new int[]{0, 0};
		gbl_pan_EV.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_pan_EV.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		pan_EV.setLayout(gbl_pan_EV);
		
		btnDownEV = new JButton("-");
		GridBagConstraints gbc_btnDownEV = new GridBagConstraints();
		gbc_btnDownEV.insets = new Insets(0, 0, 0, 5);
		gbc_btnDownEV.gridx = 0;
		gbc_btnDownEV.gridy = 0;
		pan_EV.add(btnDownEV, gbc_btnDownEV);
		
		btnDownEV.addActionListener(this);
		
		
		evActu = new JTextField(Integer.toString(perso.getEnergieVitaleActuelle()));
		GridBagConstraints gbc_avActu = new GridBagConstraints();
		gbc_avActu.insets = new Insets(0, 0, 0, 5);
		gbc_avActu.fill = GridBagConstraints.HORIZONTAL;
		gbc_avActu.gridx = 1;
		gbc_avActu.gridy = 0;
		pan_EV.add(evActu, gbc_avActu);
		evActu.setColumns(10);
		
		evActu.addActionListener(this);
		
		
		evMax = new JTextField(Integer.toString(perso.getEnergieVitaleMax()));
		GridBagConstraints gbc_evMax = new GridBagConstraints();
		gbc_evMax.insets = new Insets(0, 0, 0, 5);
		gbc_evMax.fill = GridBagConstraints.HORIZONTAL;
		gbc_evMax.gridx = 2;
		gbc_evMax.gridy = 0;
		pan_EV.add(evMax, gbc_evMax);
		evMax.setColumns(10);
		
		evMax.addActionListener(this);
		
		
		btnUpEV = new JButton("+");
		GridBagConstraints gbc_btnUpEV = new GridBagConstraints();
		gbc_btnUpEV.gridx = 3;
		gbc_btnUpEV.gridy = 0;
		pan_EV.add(btnUpEV, gbc_btnUpEV);
		
		btnUpEV.addActionListener(this);
		
		
		JPanel panCou = new JPanel();
		panel_3.add(panCou);
		GridBagLayout gbl_panCou = new GridBagLayout();
		gbl_panCou.columnWidths = new int[]{0, 60, 60, 0, 0};
		gbl_panCou.rowHeights = new int[]{0, 0};
		gbl_panCou.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panCou.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panCou.setLayout(gbl_panCou);
		
		btnDownCou = new JButton("-");
		GridBagConstraints gbc_btnDownCou = new GridBagConstraints();
		gbc_btnDownCou.insets = new Insets(0, 0, 0, 5);
		gbc_btnDownCou.gridx = 0;
		gbc_btnDownCou.gridy = 0;
		panCou.add(btnDownCou, gbc_btnDownCou);
		
		btnDownCou.addActionListener(this);
		
		
		JLabel lblCou = new JLabel("Cou : ");
		GridBagConstraints gbc_lblCou = new GridBagConstraints();
		gbc_lblCou.insets = new Insets(0, 0, 0, 5);
		gbc_lblCou.gridx = 1;
		gbc_lblCou.gridy = 0;
		panCou.add(lblCou, gbc_lblCou);
		
		tfCou = new JTextField(Integer.toString(perso.getCourage()));
		GridBagConstraints gbc_tfCou = new GridBagConstraints();
		gbc_tfCou.insets = new Insets(0, 0, 0, 5);
		gbc_tfCou.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfCou.gridx = 2;
		gbc_tfCou.gridy = 0;
		panCou.add(tfCou, gbc_tfCou);
		tfCou.setColumns(10);
		
		tfCou.addActionListener(this);
		
		
		btnUpCou = new JButton("+");
		GridBagConstraints gbc_btnUpCou = new GridBagConstraints();
		gbc_btnUpCou.gridx = 3;
		gbc_btnUpCou.gridy = 0;
		panCou.add(btnUpCou, gbc_btnUpCou);
		
		btnUpCou.addActionListener(this);
		
		
		JPanel panInt = new JPanel();
		panel_3.add(panInt);
		GridBagLayout gbl_panInt = new GridBagLayout();
		gbl_panInt.columnWidths = new int[]{0, 60, 60, 0, 0};
		gbl_panInt.rowHeights = new int[]{0, 0};
		gbl_panInt.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panInt.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panInt.setLayout(gbl_panInt);
		
		btnDownInt = new JButton("-");
		GridBagConstraints gbc_btnDownInt = new GridBagConstraints();
		gbc_btnDownInt.insets = new Insets(0, 0, 0, 5);
		gbc_btnDownInt.gridx = 0;
		gbc_btnDownInt.gridy = 0;
		panInt.add(btnDownInt, gbc_btnDownInt);
		
		btnDownInt.addActionListener(this);
		
		
		JLabel lblInt = new JLabel("Int : ");
		GridBagConstraints gbc_lblInt = new GridBagConstraints();
		gbc_lblInt.insets = new Insets(0, 0, 0, 5);
		gbc_lblInt.gridx = 1;
		gbc_lblInt.gridy = 0;
		panInt.add(lblInt, gbc_lblInt);
		
		tfInt = new JTextField(Integer.toString(perso.getIntel()));
		GridBagConstraints gbc_tfInt = new GridBagConstraints();
		gbc_tfInt.insets = new Insets(0, 0, 0, 5);
		gbc_tfInt.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfInt.gridx = 2;
		gbc_tfInt.gridy = 0;
		panInt.add(tfInt, gbc_tfInt);
		tfInt.setColumns(10);
		
		tfInt.addActionListener(this);
		
		
		btnUpInt = new JButton("+");
		GridBagConstraints gbc_btnUpInt = new GridBagConstraints();
		gbc_btnUpInt.gridx = 3;
		gbc_btnUpInt.gridy = 0;
		panInt.add(btnUpInt, gbc_btnUpInt);
		
		btnUpInt.addActionListener(this);
		
		
		JPanel panCha = new JPanel();
		panel_3.add(panCha);
		GridBagLayout gbl_panCha = new GridBagLayout();
		gbl_panCha.columnWidths = new int[]{0, 60, 60, 0, 0};
		gbl_panCha.rowHeights = new int[]{0, 0};
		gbl_panCha.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panCha.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panCha.setLayout(gbl_panCha);
		
		btnDownCha = new JButton("-");
		GridBagConstraints gbc_btnDownCha = new GridBagConstraints();
		gbc_btnDownCha.insets = new Insets(0, 0, 0, 5);
		gbc_btnDownCha.gridx = 0;
		gbc_btnDownCha.gridy = 0;
		panCha.add(btnDownCha, gbc_btnDownCha);
		
		btnDownCha.addActionListener(this);
		
		
		JLabel lblCha = new JLabel("Cha : ");
		GridBagConstraints gbc_lblCha = new GridBagConstraints();
		gbc_lblCha.insets = new Insets(0, 0, 0, 5);
		gbc_lblCha.gridx = 1;
		gbc_lblCha.gridy = 0;
		panCha.add(lblCha, gbc_lblCha);
		
		tfCha = new JTextField(Integer.toString(perso.getCharisme()));
		GridBagConstraints gbc_tfCha = new GridBagConstraints();
		gbc_tfCha.insets = new Insets(0, 0, 0, 5);
		gbc_tfCha.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfCha.gridx = 2;
		gbc_tfCha.gridy = 0;
		panCha.add(tfCha, gbc_tfCha);
		tfCha.setColumns(10);
		
		tfCha.addActionListener(this);
		
		
		btnUpCha = new JButton("+");
		GridBagConstraints gbc_btnUpCha = new GridBagConstraints();
		gbc_btnUpCha.gridx = 3;
		gbc_btnUpCha.gridy = 0;
		panCha.add(btnUpCha, gbc_btnUpCha);
		
		btnUpCha.addActionListener(this);
		
		
		JPanel panAdr = new JPanel();
		panel_3.add(panAdr);
		GridBagLayout gbl_panAdr = new GridBagLayout();
		gbl_panAdr.columnWidths = new int[]{0, 60, 60, 0, 0};
		gbl_panAdr.rowHeights = new int[]{0, 0};
		gbl_panAdr.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panAdr.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panAdr.setLayout(gbl_panAdr);
		
		btnDownAdr = new JButton("-");
		GridBagConstraints gbc_btnDownAdr = new GridBagConstraints();
		gbc_btnDownAdr.insets = new Insets(0, 0, 0, 5);
		gbc_btnDownAdr.gridx = 0;
		gbc_btnDownAdr.gridy = 0;
		panAdr.add(btnDownAdr, gbc_btnDownAdr);
		
		btnDownAdr.addActionListener(this);
		
		
		JLabel lblAdr = new JLabel("Adr : ");
		GridBagConstraints gbc_lblAdr = new GridBagConstraints();
		gbc_lblAdr.insets = new Insets(0, 0, 0, 5);
		gbc_lblAdr.gridx = 1;
		gbc_lblAdr.gridy = 0;
		panAdr.add(lblAdr, gbc_lblAdr);
		
		tfAdr = new JTextField(Integer.toString(perso.getAd()));
		GridBagConstraints gbc_tfAdr = new GridBagConstraints();
		gbc_tfAdr.insets = new Insets(0, 0, 0, 5);
		gbc_tfAdr.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfAdr.gridx = 2;
		gbc_tfAdr.gridy = 0;
		panAdr.add(tfAdr, gbc_tfAdr);
		tfAdr.setColumns(10);
		
		tfAdr.addActionListener(this);
		
		
		btnUpAdr = new JButton("+");
		GridBagConstraints gbc_btnUpAdr = new GridBagConstraints();
		gbc_btnUpAdr.gridx = 3;
		gbc_btnUpAdr.gridy = 0;
		panAdr.add(btnUpAdr, gbc_btnUpAdr);
		
		btnUpAdr.addActionListener(this);
		
		
		JPanel panFo = new JPanel();
		panel_3.add(panFo);
		GridBagLayout gbl_panFo = new GridBagLayout();
		gbl_panFo.columnWidths = new int[]{0, 60, 60, 0, 0};
		gbl_panFo.rowHeights = new int[]{23, 0};
		gbl_panFo.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panFo.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panFo.setLayout(gbl_panFo);
		
		btnDownFo = new JButton("-");
		GridBagConstraints gbc_btnDownFo = new GridBagConstraints();
		gbc_btnDownFo.insets = new Insets(0, 0, 0, 5);
		gbc_btnDownFo.gridx = 0;
		gbc_btnDownFo.gridy = 0;
		panFo.add(btnDownFo, gbc_btnDownFo);
		
		btnDownFo.addActionListener(this);
		
		
		JLabel lblFo = new JLabel("Fo : ");
		GridBagConstraints gbc_lblFo = new GridBagConstraints();
		gbc_lblFo.insets = new Insets(0, 0, 0, 5);
		gbc_lblFo.gridx = 1;
		gbc_lblFo.gridy = 0;
		panFo.add(lblFo, gbc_lblFo);
		
		tfFo = new JTextField(Integer.toString(perso.getForce()));
		GridBagConstraints gbc_tfFo = new GridBagConstraints();
		gbc_tfFo.insets = new Insets(0, 0, 0, 5);
		gbc_tfFo.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfFo.gridx = 2;
		gbc_tfFo.gridy = 0;
		panFo.add(tfFo, gbc_tfFo);
		tfFo.setColumns(10);
		tfFo.setSize(60, 25);
		
		tfFo.addActionListener(this);
		
		
		btnUpFo = new JButton("+");
		GridBagConstraints gbc_btnUpFo = new GridBagConstraints();
		gbc_btnUpFo.gridx = 3;
		gbc_btnUpFo.gridy = 0;
		panFo.add(btnUpFo, gbc_btnUpFo);
		
		btnUpFo.addActionListener(this);
		
		//droite
		JPanel panel_5 = new JPanel();
		GridBagConstraints gbc_panel_5 = new GridBagConstraints();
		gbc_panel_5.fill = GridBagConstraints.BOTH;
		gbc_panel_5.gridx = 2;
		gbc_panel_5.gridy = 0;
		panel.add(panel_5, gbc_panel_5);
		panel_5.setLayout(new GridLayout(0, 1, 0, 0));
		
		JLabel lblSexe = new JLabel("Sexe : " + perso.getSexe());
		panel_5.add(lblSexe);
		
		JLabel lblMetier = new JLabel("Metier : " + perso.getMetier());
		panel_5.add(lblMetier);
		
		JPanel pan_EA = new JPanel();
		panel_5.add(pan_EA);
		GridBagLayout gbl_pan_EA = new GridBagLayout();
		gbl_pan_EA.columnWidths = new int[]{32, 60, 60, 32, 0};
		gbl_pan_EA.rowHeights = new int[]{0, 0};
		gbl_pan_EA.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_pan_EA.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		pan_EA.setLayout(gbl_pan_EA);
		
		btnDownEA = new JButton("-");
		GridBagConstraints gbc_btnDownEA = new GridBagConstraints();
		gbc_btnDownEA.insets = new Insets(0, 0, 0, 5);
		gbc_btnDownEA.gridx = 0;
		gbc_btnDownEA.gridy = 0;
		pan_EA.add(btnDownEA, gbc_btnDownEA);
		
		btnDownEA.addActionListener(this);
		
		eaActu = new JTextField(Integer.toString(perso.getEnergieAstraleActuelle()));
		eaActu.setColumns(10);
		GridBagConstraints gbc_eaActu = new GridBagConstraints();
		gbc_eaActu.fill = GridBagConstraints.HORIZONTAL;
		gbc_eaActu.insets = new Insets(0, 0, 0, 5);
		gbc_eaActu.gridx = 1;
		gbc_eaActu.gridy = 0;
		pan_EA.add(eaActu, gbc_eaActu);
		
		eaActu.addActionListener(this);
		
		
		eaMax = new JTextField(Integer.toString(perso.getEnergieAstraleMax()));
		eaMax.setColumns(10);
		GridBagConstraints gbc_eaMax = new GridBagConstraints();
		gbc_eaMax.fill = GridBagConstraints.HORIZONTAL;
		gbc_eaMax.insets = new Insets(0, 0, 0, 5);
		gbc_eaMax.gridx = 2;
		gbc_eaMax.gridy = 0;
		pan_EA.add(eaMax, gbc_eaMax);
		
		eaMax.addActionListener(this);
		
		
		btnUpEA = new JButton("+");
		GridBagConstraints gbc_btnUpEA = new GridBagConstraints();
		gbc_btnUpEA.gridx = 3;
		gbc_btnUpEA.gridy = 0;
		pan_EA.add(btnUpEA, gbc_btnUpEA);
		
		btnUpEA.addActionListener(this);
	
		
		JPanel panAt = new JPanel();
		panel_5.add(panAt);
		GridBagLayout gbl_panAt = new GridBagLayout();
		gbl_panAt.columnWidths = new int[]{0, 60, 60, 0, 0};
		gbl_panAt.rowHeights = new int[]{0, 0};
		gbl_panAt.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panAt.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panAt.setLayout(gbl_panAt);
		
		btnDownAt = new JButton("-");
		GridBagConstraints gbc_btnDownAt = new GridBagConstraints();
		gbc_btnDownAt.insets = new Insets(0, 0, 0, 5);
		gbc_btnDownAt.gridx = 0;
		gbc_btnDownAt.gridy = 0;
		panAt.add(btnDownAt, gbc_btnDownAt);
		
		btnDownAt.addActionListener(this);
		
		
		JLabel lblAt = new JLabel("AT : ");
		GridBagConstraints gbc_lblAt = new GridBagConstraints();
		gbc_lblAt.insets = new Insets(0, 0, 0, 5);
		gbc_lblAt.gridx = 1;
		gbc_lblAt.gridy = 0;
		panAt.add(lblAt, gbc_lblAt);
		
		tfAt = new JTextField(Integer.toString(perso.getAttaque()));
		tfAt.setColumns(10);
		GridBagConstraints gbc_tfAt = new GridBagConstraints();
		gbc_tfAt.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfAt.insets = new Insets(0, 0, 0, 5);
		gbc_tfAt.gridx = 2;
		gbc_tfAt.gridy = 0;
		panAt.add(tfAt, gbc_tfAt);
		
		tfAt.addActionListener(this);
		
		
		btnUpAt = new JButton("+");
		GridBagConstraints gbc_btnUpAt = new GridBagConstraints();
		gbc_btnUpAt.gridx = 3;
		gbc_btnUpAt.gridy = 0;
		panAt.add(btnUpAt, gbc_btnUpAt);
		
		btnUpAt.addActionListener(this);
		
		
		JPanel panPrd = new JPanel();
		panel_5.add(panPrd);
		GridBagLayout gbl_panPrd = new GridBagLayout();
		gbl_panPrd.columnWidths = new int[]{0, 60, 60, 0, 0};
		gbl_panPrd.rowHeights = new int[]{0, 0};
		gbl_panPrd.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panPrd.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panPrd.setLayout(gbl_panPrd);
		
		btnDownPrd = new JButton("-");
		GridBagConstraints gbc_btnDownPrd = new GridBagConstraints();
		gbc_btnDownPrd.insets = new Insets(0, 0, 0, 5);
		gbc_btnDownPrd.gridx = 0;
		gbc_btnDownPrd.gridy = 0;
		panPrd.add(btnDownPrd, gbc_btnDownPrd);
		
		btnDownPrd.addActionListener(this);
		
		
		JLabel lblPrd = new JLabel("Prd : ");
		GridBagConstraints gbc_lblPrd = new GridBagConstraints();
		gbc_lblPrd.insets = new Insets(0, 0, 0, 5);
		gbc_lblPrd.gridx = 1;
		gbc_lblPrd.gridy = 0;
		panPrd.add(lblPrd, gbc_lblPrd);
		
		tfPrd = new JTextField(Integer.toString(perso.getParade()));
		tfPrd.setColumns(10);
		GridBagConstraints gbc_tfPrd = new GridBagConstraints();
		gbc_tfPrd.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfPrd.insets = new Insets(0, 0, 0, 5);
		gbc_tfPrd.gridx = 2;
		gbc_tfPrd.gridy = 0;
		panPrd.add(tfPrd, gbc_tfPrd);
		
		tfPrd.addActionListener(this);
		
		
		btnUpPrd = new JButton("+");
		GridBagConstraints gbc_btnUpPrd = new GridBagConstraints();
		gbc_btnUpPrd.gridx = 3;
		gbc_btnUpPrd.gridy = 0;
		panPrd.add(btnUpPrd, gbc_btnUpPrd);
		
		btnUpPrd.addActionListener(this);
		
		
		JPanel panPr = new JPanel();
		panel_5.add(panPr);
		GridBagLayout gbl_panPr = new GridBagLayout();
		gbl_panPr.columnWidths = new int[]{0, 60, 60, 0, 0};
		gbl_panPr.rowHeights = new int[]{0, 0};
		gbl_panPr.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panPr.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panPr.setLayout(gbl_panPr);
		
		btnDownPr = new JButton("-");
		GridBagConstraints gbc_btnDownPr = new GridBagConstraints();
		gbc_btnDownPr.insets = new Insets(0, 0, 0, 5);
		gbc_btnDownPr.gridx = 0;
		gbc_btnDownPr.gridy = 0;
		panPr.add(btnDownPr, gbc_btnDownPr);
		
		btnDownPr.addActionListener(this);
		
		
		JLabel lblPr = new JLabel("Pr : ");
		GridBagConstraints gbc_lblPr = new GridBagConstraints();
		gbc_lblPr.insets = new Insets(0, 0, 0, 5);
		gbc_lblPr.gridx = 1;
		gbc_lblPr.gridy = 0;
		panPr.add(lblPr, gbc_lblPr);
		
		tfPr = new JTextField(Integer.toString(perso.getPr()));
		tfPr.setColumns(10);
		GridBagConstraints gbc_tfPr = new GridBagConstraints();
		gbc_tfPr.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfPr.insets = new Insets(0, 0, 0, 5);
		gbc_tfPr.gridx = 2;
		gbc_tfPr.gridy = 0;
		panPr.add(tfPr, gbc_tfPr);
		
		tfPr.addActionListener(this);
		
		
		btnUpPr = new JButton("+");
		GridBagConstraints gbc_btnUpPr = new GridBagConstraints();
		gbc_btnUpPr.gridx = 3;
		gbc_btnUpPr.gridy = 0;
		panPr.add(btnUpPr, gbc_btnUpPr);
		
		btnUpPr.addActionListener(this);
		
		
		JPanel panPDestin = new JPanel();
		panel_5.add(panPDestin);
		GridBagLayout gbl_panPDestin = new GridBagLayout();
		gbl_panPDestin.columnWidths = new int[]{0, 60, 60, 0, 0};
		gbl_panPDestin.rowHeights = new int[]{0, 0};
		gbl_panPDestin.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panPDestin.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panPDestin.setLayout(gbl_panPDestin);
		
		btnDownPDestin = new JButton("-");
		GridBagConstraints gbc_btnDownPDestin = new GridBagConstraints();
		gbc_btnDownPDestin.insets = new Insets(0, 0, 0, 5);
		gbc_btnDownPDestin.gridx = 0;
		gbc_btnDownPDestin.gridy = 0;
		panPDestin.add(btnDownPDestin, gbc_btnDownPDestin);
		
		btnDownPDestin.addActionListener(this);
		
		
		JLabel lblPDestin = new JLabel("PDestin : ");
		GridBagConstraints gbc_lblPDestin = new GridBagConstraints();
		gbc_lblPDestin.insets = new Insets(0, 0, 0, 5);
		gbc_lblPDestin.gridx = 1;
		gbc_lblPDestin.gridy = 0;
		panPDestin.add(lblPDestin, gbc_lblPDestin);
		
		tfPDestin = new JTextField(Integer.toString(perso.getPointDestin()));
		tfPDestin.setColumns(10);
		GridBagConstraints gbc_tfPDestin = new GridBagConstraints();
		gbc_tfPDestin.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfPDestin.insets = new Insets(0, 0, 0, 5);
		gbc_tfPDestin.gridx = 2;
		gbc_tfPDestin.gridy = 0;
		panPDestin.add(tfPDestin, gbc_tfPDestin);
		
		tfPDestin.addActionListener(this);
		
		
		btnUpPDestin = new JButton("+");
		GridBagConstraints gbc_btnUpPDestin = new GridBagConstraints();
		gbc_btnUpPDestin.gridx = 3;
		gbc_btnUpPDestin.gridy = 0;
		panPDestin.add(btnUpPDestin, gbc_btnUpPDestin);
		
		btnUpPDestin.addActionListener(this);
		
		
		JPanel panPo = new JPanel();
		panel_5.add(panPo);
		GridBagLayout gbl_panPo = new GridBagLayout();
		gbl_panPo.columnWidths = new int[]{0, 60, 60, 0, 0};
		gbl_panPo.rowHeights = new int[]{0, 0};
		gbl_panPo.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panPo.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panPo.setLayout(gbl_panPo);
		
		btnDownPo = new JButton("-");
		GridBagConstraints gbc_btnDownPo = new GridBagConstraints();
		gbc_btnDownPo.insets = new Insets(0, 0, 0, 5);
		gbc_btnDownPo.gridx = 0;
		gbc_btnDownPo.gridy = 0;
		panPo.add(btnDownPo, gbc_btnDownPo);
		
		btnDownPo.addActionListener(this);
		
		
		JLabel lblPo = new JLabel("Po : ");
		GridBagConstraints gbc_lblPo = new GridBagConstraints();
		gbc_lblPo.insets = new Insets(0, 0, 0, 5);
		gbc_lblPo.gridx = 1;
		gbc_lblPo.gridy = 0;
		panPo.add(lblPo, gbc_lblPo);
		
		tfPo = new JTextField(Integer.toString(perso.getRichesse()));
		tfPo.setColumns(10);
		GridBagConstraints gbc_tfPo = new GridBagConstraints();
		gbc_tfPo.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfPo.insets = new Insets(0, 0, 0, 5);
		gbc_tfPo.gridx = 2;
		gbc_tfPo.gridy = 0;
		panPo.add(tfPo, gbc_tfPo);
		
		tfPo.addActionListener(this);
		
		
		btnUpPo = new JButton("+");
		GridBagConstraints gbc_btnUpPo = new GridBagConstraints();
		gbc_btnUpPo.gridx = 3;
		gbc_btnUpPo.gridy = 0;
		panPo.add(btnUpPo, gbc_btnUpPo);
		
		btnUpPo.addActionListener(this);
		
		
		JPanel panNote = new JPanel();
		GridBagConstraints gbc_panNote = new GridBagConstraints();
		gbc_panNote.insets = new Insets(0, 0, 5, 0);
		gbc_panNote.fill = GridBagConstraints.BOTH;
		gbc_panNote.gridx = 0;
		gbc_panNote.gridy = 1;
		add(panNote, gbc_panNote);
		GridBagLayout gbl_panNote = new GridBagLayout();
		gbl_panNote.columnWidths = new int[]{40, 0, 0};
		gbl_panNote.rowHeights = new int[]{0, 0, 0};
		gbl_panNote.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
		gbl_panNote.rowWeights = new double[]{1.0, 0.0, Double.MIN_VALUE};
		panNote.setLayout(gbl_panNote);
		
		JTextArea taNote = new JTextArea();
		GridBagConstraints gbc_taNote = new GridBagConstraints();
		gbc_taNote.insets = new Insets(0, 0, 5, 5);
		gbc_taNote.fill = GridBagConstraints.BOTH;
		gbc_taNote.gridx = 1;
		gbc_taNote.gridy = 0;
		panNote.add(taNote, gbc_taNote);
		
		JLabel lblNewLabel = new JLabel("");
		GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
		gbc_lblNewLabel.insets = new Insets(0, 0, 0, 5);
		gbc_lblNewLabel.gridx = 0;
		gbc_lblNewLabel.gridy = 1;
		panNote.add(lblNewLabel, gbc_lblNewLabel);

	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		if(e.getSource()==btnUpAdr)
			perso.setAd(perso.getAd()+1);
		else if(e.getSource()==btnDownAdr)
			perso.setAd(perso.getAd()-1);
		else if(e.getSource()==btnDownAt)
			perso.setAttaque(perso.getAttaque()-1);
		else if(e.getSource()==btnUpAt)
			perso.setAttaque(perso.getAttaque()+1);
		else if(e.getSource()==btnDownCha)
			perso.setCharisme(perso.getCharisme()-1);
		else if(e.getSource()==btnUpCha)
			perso.setCharisme(perso.getCharisme()+1);
		else if(e.getSource()==btnDownCou)
			perso.setCourage(perso.getCourage()-1);
		else if(e.getSource()==btnUpCou)
			perso.setCourage(perso.getCourage()+1);
		else if(e.getSource()==btnDownEA)
			perso.setEnergieAstraleActuelle(perso.getEnergieAstraleActuelle()-1);
		else if(e.getSource()==btnUpEA)
			perso.setEnergieAstraleActuelle(perso.getEnergieAstraleActuelle()+1);
		else if(e.getSource()==btnDownEV)
			perso.setEnergieVitaleActuelle(perso.getEnergieVitaleActuelle()-1);
		else if(e.getSource()==btnUpEV)
			perso.setEnergieVitaleActuelle(perso.getEnergieVitaleActuelle()+1);
		else if(e.getSource()==btnDownFo)
			perso.setForce(perso.getForce()-1);
		else if(e.getSource()==btnUpFo)
			perso.setForce(perso.getForce()+1);
		else if(e.getSource()==btnDownInt)
			perso.setIntel(perso.getIntel()-1);
		else if(e.getSource()==btnUpInt)
			perso.setIntel(perso.getIntel()+1);
		else if(e.getSource()==btnDownPDestin)
			perso.setPointDestin(perso.getPointDestin()-1);
		else if(e.getSource()==btnUpPDestin)
			perso.setPointDestin(perso.getPointDestin()+1);
		else if(e.getSource()==btnDownPo)
			perso.setRichesse(perso.getRichesse()-1);
		else if(e.getSource()==btnUpPo)
			perso.setRichesse(perso.getRichesse()+1);
		else if(e.getSource()==btnDownPr)
			perso.setPr(perso.getPr()-1);
		else if(e.getSource()==btnUpPr)
			perso.setPr(perso.getPr()+1);
		else if(e.getSource()==btnDownPrd)
			perso.setParade(perso.getParade()-1);
		else if(e.getSource()==btnUpPrd)
			perso.setParade(perso.getParade()+1);
	
		this.MajPersonnageDet();
		this.repaint();	
	}
	
	public void MajPersonnageDet(){
		evActu.setText(Integer.toString(perso.getEnergieVitaleActuelle()));
		evMax.setText(Integer.toString(perso.getEnergieVitaleMax()));
		tfCou.setText(Integer.toString(perso.getCourage()));
		tfInt.setText(Integer.toString(perso.getIntel()));
		tfCha.setText(Integer.toString(perso.getCharisme()));
		tfAdr.setText(Integer.toString(perso.getAd()));
		tfFo.setText(Integer.toString(perso.getForce()));
		eaActu.setText(Integer.toString(perso.getEnergieAstraleActuelle()));
		eaMax.setText(Integer.toString(perso.getEnergieAstraleMax()));
		tfAt.setText(Integer.toString(perso.getAttaque()));
		tfPrd.setText(Integer.toString(perso.getParade()));
		tfPr.setText(Integer.toString(perso.getPr()));
		tfPDestin.setText(Integer.toString(perso.getPointDestin()));
		tfPo.setText(Integer.toString(perso.getRichesse()));
	}
	
	public static void main(String[] arg){
		try {
			Personnage d = null;
			// lecture du fichier
			InputStream flux = new FileInputStream("personnage.csv");
			InputStreamReader lecture = new InputStreamReader(flux);
			BufferedReader buff = new BufferedReader(lecture);

			String ligne;
			ligne = buff.readLine();

			while ((ligne = buff.readLine()) != null) {
				String[] tab = ligne.split("\t");
				d = new Personnage(tab[0], tab[1], tab[2], tab[3],
						Integer.parseInt(tab[4]), Integer.parseInt(tab[5]),
						Integer.parseInt(tab[6]), Integer.parseInt(tab[7]),
						Integer.parseInt(tab[8]), Integer.parseInt(tab[9]),
						Integer.parseInt(tab[10]), Integer.parseInt(tab[11]),
						Integer.parseInt(tab[12]), Integer.parseInt(tab[13]),
						Integer.parseInt(tab[14]), Integer.parseInt(tab[15]),
						Integer.parseInt(tab[16]), Integer.parseInt(tab[17]),
						Integer.parseInt(tab[18]), Integer.parseInt(tab[19]),
						tab[20]);
			}
			System.out.println("1: " + d.toString());
			buff.close();
			
			FenetrePrincipale f = new FenetrePrincipale();
			
			PersonnageDet det = new PersonnageDet(d);
			f.getContentPane().add(det);
			f.setVisible(true);
		} catch (Exception e) {
			System.out.println(e.toString());
		}	
	}
}
